<?
include "conf/db_connect.php";
$date = $_SESSION['date'];


$luni = array("ianuarie","februarie","martie","aprilie","mai","iunie","iulie","august","septembrie","octombrie","noiembrie","decembrie");

if(sizeof($_POST)){
include "conf/upload.php";
include "conf/inserare.php";

if($_POST['password'] == $_POST['password2']){
	if($_POST['password'] != ""){
		$_POST['password'] = md5($_POST['password']);
		mysql_query("update membri set password = '{$_POST['password']}' where id = '{$date['id']}'");
	}
	$_POST['data_nasterii'] = $_POST['an']."-".$_POST['luna']."-".$_POST['zi'];
	$msg = insert_data("membri","update","zi,luna,an,password2,password,Submit,poza","nume",$date['id'],"id");				
	if($_FILES['poza']['size'] > 0){
	
		if(file_exists("/home/bestgame/public_html/diete4u/users/".$date['poza']) && $date['poza'] != ''){
			unlink("/home/bestgame/public_html/diete4u/users/".$date['poza']);
			unlink("/home/bestgame/public_html/diete4u/users/".$date['poza_th']);
		}
		
		$c = 'user_'.$date['id'].'_'.rand(10000,99999);
		$cale = $c;
		$cale_th = $c.'_th';
		
		$msg_image = incarca('poza','/home/bestgame/public_html/diete4u/users',$cale,$cale_th,'width',250,100,true);
		mysql_query("update membri set poza = '{$msg_image[1]}', poza_th = '{$msg_image[2]}' where id = '{$date['id']}'") or die(mysql_error());
	}
	$login->refreshDate();
	$date = $_SESSION['date'];
}else{
$msg = "Cele doua parole nu coincid.";
}
									
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/index.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Diete Online</title>
<!-- InstanceEndEditable -->
<?
if($desc == ''){ 
	$desc = 'Site-ul www.diete4u.com este dedicat in special persoanelor interesate de diete, de mentinerea sau recuperarea sanatatii lor. Diete4u contine o gama vasta de articole, cu multiple teme: sanatate, diete, gastronomie, casa, familie, fiind un ghid pentru persoanele moderne, dornice de a fi informate in variate domenii.';
}
?>
<meta name="description" content="<? echo $desc; ?>" /> 
  <meta name="keywords" content="diete, fitness, remedii naturiste boli, comunitate online nutritie, sfaturi alimentatie, gastronomie, psihologie" /> 
  <META name="subjects" content="diete online, retete, gastronomie, articole slabire, fitness, remedii boli, portal articole fitness"> 
  <META name="rating" content="General"> 
  <META name="language" content="romanian, RO"> 
  <META name="expires" content="never"> 
  <META name="revisit-after" content="1 Days"> 
  <META content="INDEX, FOLLOW" name="robots"> 
  <META name="publisher" content="www.diete4u.com"> 
  <META name="copyright" content="Copyright (c) WDM INFOGENERAL SRL"> 
  <META name="author" CONTENT="WDM INFOGENERAL - www.webdesignmedia.ro"> 
  <META name="classification" content="diete online"> 
<base href="<?=$CS?>" />
<link href="style.css" rel="stylesheet" type="text/css" />
<script src="conf/functii.js"></script>
<!-- InstanceBeginEditable name="head" -->
<style type="text/css">
<!--
.style4 {color: #000000; padding:4px;}
-->
</style>
<!-- InstanceEndEditable -->
</head>

<body>
<div style="position:absolute; left:0; top:0; width:100%; height:1000px; cursor:pointer; z-index:0;" onclick="window.location='http://www.rochiionline.com'"></div>
<div id="holder">
<div id="content">
  <div id="sus"><a href="<?=$CS?>"><img src="logo_mic.jpg" alt="Diete, Sanatate, Remedii boli, Retete" width="141" height="59" border="0" /></a>
  <div id="search_box">
    <form id="form2" name="form2" method="get" action="cautare/">
    <br />
      <input name="q" type="text" class="inp1" id="q" value="Cauta" onfocus="value=''" /> 
          <input type="submit" class="buton" value="Ok" />
    </form>
   </div>
  <div id="newsletter"><a href="newsletter/">Abonati-va la newsletterul Diete4u.com</a></div>
  <div id="harta"><a href="harta-site/">Harta Site</a></div>
  </div>
  <div id="butoane">
  <div><a href="<?=$CS?>">Home</a>  
  <?
  $sql = "select * from categorii where peHome = '1' order by ordine";
  $ret = mysql_query($sql) or die(mysql_error());
  while($ca = mysql_fetch_array($ret)){
  ?>
    : <a href="<?=$CS?>articole/<?=$ca['link']?>/"><?=$ca['nume']?></a>
    <?
  }
	?>
     : <a href="<?=$CS?>contul-meu/">Contul meu</a> : <a href="<?=$CS?>contact/">Contact</a> </div>
  </div>
  <div id="header">
  <div id="poza1"><a href="<?=$CS?>articole/diete/" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Diete','','images/header_on_01.jpg',1)"><img src="images/header_01.jpg" name="Diete" width="200" height="200" border="0" id="Diete" /></a></div>
  <div id="poza2"><a href="<?=$CS?>articole/remedii-boli/" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image2','','images/header_on_02.jpg',1)"><img src="images/header_02.gif" name="Image2" width="200" height="200" border="0" id="Image2" /></a></div>
  <div id="poza3"><a href="<?=$CS?>articole/nutritie/" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image3','','images/header_on_03.jpg',1)"><img src="images/header_03.jpg" name="Image3" width="200" height="200" border="0" id="Image3" /></a></div>
  <div id="poza4"><a href="<?=$CS?>articole/gastronomie/" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image4','','images/header_on_04.jpg',1)"><img src="images/header_04.gif" name="Image4" width="200" height="200" border="0" id="Image4" /></a></div>
  <div id="poza5"><a href="<?=$CS?>articole/psihologie/" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image5','','images/header_on_05.jpg',1)"><img src="images/header_05.gif" name="Image5" width="200" height="200" border="0" id="Image5" /></a></div>
  </div>
  <div id="continut">
  <div id="left_col">
  <div>	
    <!-- InstanceBeginEditable name="continut" -->
    <h1 class="tit"> <a href="<?=$CS?>contul-meu/">Contul meu</a> &laquo; Date Cont</h1>
	<?
	if($msg == "ok"){
	?>
	<p class="p_ok">Datele au fost salvate cu succes.</p>
	<?
	}else if($msg != ""){
	?>
	<p class="p_ok"><?=$msg?></p>
	<?
	}
	?>
    <table width="100%" border="0" cellpadding="2" cellspacing="2" onclick="hide_them(document.inregistrare)" style="border:#CCCCCC 1px solid">
      <form action="<?=$CS?>date-cont/" method="post" enctype="multipart/form-data" name="inregistrare" id="inregistrare">


        <tr>
          <td align="right">Nume</td>
          <td><input name="nume" type="text" class="inpul" id="nume" value="<?=$date['nume']?>" size="30" /></td>
          <td width="50%" rowspan="11" valign="top" bgcolor="#fafafa"><?
		  if(file_exists("/home/bestgame/public_html/diete4u/users/".$date['poza']) && $date['poza'] != ''){
		  list($w,$h) = getimagesize("/home/bestgame/public_html/diete4u/users/".$date['poza']);
		  $rap = $w / $h;
		  $w = 200;
		  $h = round(200/$rap);
		  ?>
            <img src="users/<?=$date['poza']?>" width="<?=$w?>" height="<?=$h?>" />
            <?
		  }
		  ?></td>
        </tr>
        <tr>
          <td align="right">Prenume</td>
          <td><input name="prenume" type="text" class="inpul" id="prenume" value="<?=$date['prenume']?>" size="30" /></td>
          </tr>
        <tr>
          <td width="21%" align="right" bgcolor="#FFDFDF"><strong>Schimbare parola </strong></td>
          <td bgcolor="#FFDFDF">&nbsp;</td>
          </tr>
        <tr>
          <td align="right" bgcolor="#FFDFDF">Noua parola</td>
          <td width="29%" bgcolor="#FFDFDF"><input name="password" type="password" class="inpul" id="password" size="30" onblur="hide_them(document.inregistrare)" value="" />
              <span class="style4" id="password_s"> </span></td>
          </tr>
        <tr>
          <td align="right" bgcolor="#FFDFDF">Noua parola din nou</td>
          <td bgcolor="#FFDFDF"><input name="password2" type="password" class="inpul" id="password22" size="30" onblur="hide_them(document.inregistrare)" value="" />
              <span class="style4" id="password2_s"> </span></td>
          </tr>
        <tr>
          <td align="right">Oras</td>
          <td><input name="oras" type="text" class="inpul" id="oras" value="<?=$date['oras']?>" size="30" /></td>
          </tr>
        <tr>
          <td align="right">Judet</td>
          <td><select name="judet" id="judet">
              <?
		  $sql = "select * from judete";
		  $res = mysql_query($sql);
		  while($j = mysql_fetch_array($res)){
		  ?>
              <option value="<?=$j['id']?>" <? if($j['id'] == $date['judet']){ ?>selected="selected" <? } ?>>
                <?=$j['judet']?>
                </option>
              <?
		  }
		  ?>
            </select></td>
          </tr>
        <tr>
          <td align="right">Data nasterii </td>
          <td><table border="0" cellspacing="2" cellpadding="2">
              <tr>
                <td>
				<?
				$d = explode("-",$date['data_nasterii']);
				?>
				<select name="zi" class="inpul" id="zi">
                    <option value="0">
                    <?=setare('ZZ')?>
                    </option>
                    <?

														for($i=1;$i<32;$i++){

															?>
                    <option value="<?=($i<10)?("0".$i):$i?>" <? if(intval($d[2]) == $i){ ?>selected="selected" <? } ?>>
                    <?=($i<10)?("0".$i):$i?>
                    </option>
                    <?

														}

														?>
                </select></td>
                <td><select name="luna" class="inpul" id="luna">
                    <option value="0">
                    <?=setare('LL')?>
                    </option>
                    <?

														for($i=0;$i<12;$i++){

															?>
                    <option value="<?=($i<9)?("0".($i+1)):($i+1)?>" <? if(intval($d[1]) == ($i+1)){ ?>selected="selected" <? } ?>>
                    <?=$luni[$i]?>
                    </option>
                    <?

															}

															?>
                </select></td>
                <td><select name="an" class="inpul" id="an">
                    <option value="0">
                    <?=setare('AAAA')?>
                    </option>
                    <?

															for($i=1996;$i>1920;$i--){

															?>
                    <option value="<?=$i?>"  <? if(intval($d[0]) == $i){ ?>selected="selected" <? } ?>>
                    <?=$i?>
                    </option>
                    <?

															}

															?>
                </select></td>
                <td width="250"><span class="style4" id="data_n_s"> </span></td>
              </tr>
          </table></td>
          </tr>
        <tr>
          <td align="right">Schimba  imagine avatar (jpg sau gif) </td>
          <td><input name="poza" type="file" id="poza" /></td>
          </tr>
        <tr>
          <td align="right">Site</td>
          <td><input name="site" type="text" class="inpul" id="site" value="<?=$date['site']?>" size="30" /></td>
          </tr>
        <tr>
          <td align="right">Profesie</td>
          <td><input name="profesie" type="text" class="inpul" id="profesie" value="<?=$date['profesie']?>" size="30" /></td>
          </tr>

        <tr>
          <td align="left">&nbsp;</td>
          <td colspan="2"><input name="Submit" type="submit" class="buton" id="Submit" value="Salveaza informatii" /></td>
        </tr>
      </form>
    </table>
    <script>limba = 'ro';</script>
<!-- InstanceEndEditable --></div>
  </div>
  <div id="right_col">
  <div id="boxul" style="margin-top:10px; margin-bottom:10px;">
<div id="box_top">
<img src="images/box_01.jpg" width="182" height="15" alt="">
</div>
<div id="box_middle">
<div>
<?
if(!$login->logged_in){
?>
 <span class="titluri">
 Login
 </span>
 <?
 if(!$login->logged_in && isset($_POST['username'])){
 ?>
 <p style="border:#CC0000; color:#990000">User sau parola gresite.</p>
 <?
 }else{
 ?>
 <br />
 <br />
 <?
 }
 ?>
 <form id="form1" name="form1" method="post" action="">
   <p>
     <input name="username" type="text" class="inp1" id="username" value="nume de utilizator" onfocus="value=''" />
     <br />
     <br />
     <input name="password" type="password" class="inp1" id="password" value="parola" onfocus="value=''"/>
     <br />
     <br />
     <input name="Submit" type="submit" class="buton" value="Intra in cont" />
     <br />
     <br />
     <a href="<?=$CS?>inregistrare/">Inregistrare</a>   <br />
     <br />
     <a href="<?=$CS?>parola-uitata/">Parola uitata   </a></p>
   </form>
 <?
 }else{
 $lk = $CS."useri/?id=".$_SESSION['date']['id']."&user=".$_SESSION['date']['nume']."-".$_SESSION['date']['prenume'];
 ?>
 Bine ai venit, <a href="<? echo "useri/?nume=".$_SESSION['date']['nume']."-".$_SESSION['date']['prenume']."&id=".$_SESSION['date']['id']; ?>">
 <?=$_SESSION['date']['prenume']." ".substr($_SESSION['date']['nume'],0,1)?></a>!
 <p>
 <a href="contul-meu/"><img src="images/contul_meu.jpg" border="0" /></a><br />
 <br />
 <a href="logout/"><img src="images/logout.jpg" border="0" /></a> </p>
 <?
 }
 ?>
 </div>
</div>
<div id="box_bottom"></div>
</div>
<div id="boxul" style="margin-top:10px; margin-bottom:10px;">
<div id="box_top">
<img src="images/box_01.jpg" width="182" height="15" alt="">
</div>
<div id="box_middle">
<div>
 <span class="titluri">
 Articole interesante </span>
 <ul class="lista">
 <?
 $sql = "select * from articole where valid = '1' order by nota/note desc, note desc, id desc limit 0,4";
 
 $res = mysql_query($sql) or die(mysql_error());
 
 while($a = mysql_fetch_array($res)){
 $link = $CS."articol/".str_replace(array(" ","'",'"',"&","?"),"-",$a['titlu'])."/".$a['id']."/";
 ?>
 <li>
 <a href="<?=$link?>">
 <?=$a['titlu']?>
 </a>
 </li>
 <?
 }
 ?>
 </ul>
</div>
</div>
<div id="box_bottom"></div>
</div>
  </div>
  </div>
  <div id="footer">
  <div>
  Copyright &copy; 2012 | Realizat de B&#259;nic&#259; Livia-Elena<a href="http://www.webdesignmedia.ro"><br />
  </a><br />
  <a href="<?=$CS?>">Home</a> 
  <?
  $sql = "select * from categorii";
  $res = mysql_query($sql) or die(mysql_error());
  while($c = mysql_fetch_array($res)){
  ?>
  | <a href="articole/<?=$c['link']?>/"><?=$c['nume']?></a>
  <?
  }
  ?><br />
  
  </div>
  </div>
</div>
</div>
<script>
MM_preloadImages('images/header_on_01.jpg','images/header_on_02.jpg','images/header_on_03.jpg','images/header_on_04.jpg','images/header_on_05.jpg');
</script>
</body>
<!-- InstanceEnd --></html>
